package com.heima.user.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.pojos.ApUser;
import com.heima.model.user.vos.UserLoginVO;
import com.heima.user.service.UserService;
import lombok.RequiredArgsConstructor;
import org.apache.catalina.mapper.Mapper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @projectName: heima-leadnews
 * @package: com.heima.user.controller
 * @className: UserController
 * @author: Eric
 * @description: TODO
 * @date: 2023/11/3 11:18
 * @version: 1.0
 */
@RequestMapping("/api/v1/login")
@RestController
@RequiredArgsConstructor
public class UserController {

    private final UserService userService;

    @PostMapping("/login_auth")
    public ResponseResult<UserLoginVO> loginAuth(@RequestBody ApUser apUser){
        UserLoginVO userLoginVO = userService.loginAuth(apUser);
        return ResponseResult.okResult(userLoginVO);
    }
}
